package com.bnc.menu.schedule;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.bnc.dto.PlanDTO;
import com.bnc.manager.JDBCManager;

public class modifyAction {

	private JDBCManager jdbcManager;
	private PreparedStatement pstmt;
	
	public modifyAction(){
		
		jdbcManager = JDBCManager.getInstance();
		
		String title = schedulePopup.titleTF.getText();
		String note = schedulePopup.storyTA.getText();
		
		String query = "update tbl_plan "+ 
				               "set plan_title=?, plan_note=?, plan_time=? "+
				               "where plan_no=?";
		
		pstmt = jdbcManager.prepareStatement( query );
		
		try {
			pstmt.setString( 1, title );
			pstmt.setString( 2, note );
			pstmt.setString(3, (String) schedulePopup.starttime.getSelectedItem()+"."+(String) schedulePopup.endtime.getSelectedItem());
			pstmt.setInt( 4, scheduleDetail.nosp );
			pstmt.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try {
				if(pstmt != null)
				pstmt.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}		
		
		}
	}
}
